<template>
  <div v-if="infoobj">
    <!-- 面包屑区域 -->
    <BreadDetail :category="infoobj.categories" :name="infoobj.name"></BreadDetail>
    <!-- 商品基本信息区域 -->
    <div class="goods-info">
      <div class="media">
        <Goodsimage :imgarr="infoobj.mainPictures"></Goodsimage>
      </div>
      <div class="spec"></div>
    </div>
    <!-- 同类商品推荐区域 -->
    <!-- 商品详情区域 -->
  </div>
</template>

<script>
import { getDetail } from "@/utils/api/detail"
import BreadDetail from "./BreadDetail.vue";
import Goodsimage from "./GoodsImage.vue";
export default {
  components: {
    BreadDetail,
    Goodsimage
  },

  data() {
    return {
      infoobj: {}
    };
  },

  mounted() {
    this.getDetailList(this.$route.query.id)
    console.log(this.$route.query.id);
  },

  methods: {
    async getDetailList(id) {
      let res = await getDetail(id)
      this.infoobj = res.result
    }
  },
};
</script>

<style lang="scss" scoped>
.goods-info {
  min-height: 600px;
  background: #fff;
  display: flex;

  .media {
    width: 580px;
    height: 600px;
    padding: 30px 50px;
  }

  .spec {
    flex: 1;
    padding: 30px 30px 30px 0;
  }
}
</style>